var CUSTOM_OBJECT = "custom";

$.extend(true, CustomObject.prototype, objectBase);

// Class for creating custom rectangular shapes like bar
function CustomObject(options) {

    // Default Options
    var defaultOptions = {
        top: 0,
        left: 0,
        width: 100,
        height: 100,
        text: "",
        color: "black",
        orientation: 0,
        background: "white",
        border: "1px solid black",
        radius: 0,
        fontSize: 16
    };

    // Create current configuration
    this.state = $.extend(true, defaultOptions, options);
}

// Method for creating HTML element
CustomObject.prototype.getElement = function () {
    if (this.element){
        return this.element
    }

    var element;
    element = $("<div/>");

    this.updateElement(element);

    return element;
};

// Method providing access to move with the object
CustomObject.prototype.resize = function (width, height){
    this.state.width = width;
    this.state.height = height;
    this.getElement().width(width);
    this.getElement().height(height);
}

CustomObject.prototype.getWidth = function (){
    return this.state.width;
}

CustomObject.prototype.getHeight = function (){
    return this.state.height;
}

CustomObject.prototype.setState = function (state){
    this.state = state;
    this.updateElement(this.element);
};

CustomObject.prototype.updateElement = function (element){
    element.empty();

    element.text(this.state.text);
    element.width(this.state.width);
    element.height(this.state.height);
    element.css("line-height", this.state.height + "px");
    element.css("text-align", "center");

    element.css("position", "absolute");
    element.css("left", this.state.left + "px");
    element.css("top", this.state.top + "px");
    element.css("background", this.state.background);

    element.css("color", this.state.color);

    element.css("font-size", this.state.fontSize + "px");

    if (this.state.border){
        element.css("border", this.state.border);
        element.css("border-radius", this.state.radius + "px");
        element.css("moz-border-radius", this.state.radius + "px");
    }

    if (this.state.orientation){
        element.css("transform", "rotate(" + this.state.orientation + "deg)");
        element.css('-ms-transform', "rotate(" + this.state.orientation + "deg)");
        element.css("-moz-transform", "rotate(" + this.state.orientation + "deg)");
        element.css("-webkit-transform", "rotate(" + this.state.orientation + "deg)");
        element.css("-o-transform", "rotate(" + this.state.orientation + "deg)");
    }

    this.element = element;
}
